#!/usr/bin/env python
# coding=utf-8
# __author__ = 'Yunchao Ling'

import os
import sys

path = sys.argv[1]
os.chdir(path)
os.system("mkdir -p ../../pmc_compress/" + path)
for i in xrange(int("00", 16), int("ff", 16) + 1):
    currentstr = "{0:0>2x}".format(i)
    cmd = "tar zxf " + path + currentstr + ".tar.gz"
    os.system(cmd)
    print cmd
    os.system("mv " + path + currentstr + " " + currentstr)
    os.system("mv " + path + currentstr + ".tar.gz ../../pmc_compress/" + path + "/")
    os.system("mv " + path + currentstr + ".tar.gz.md5 ../../pmc_compress/" + path + "/")
